package com.tuzhi.base.jpa.domain;

import java.util.List;

/**
 * 功能说明：
 *
 * @author abu
 * @version 1.1.0
 * @date 2023/3/5
 */
public class Pager<T> {
    int page = 0;
    int size = 10;
    int totalPage;
    long totalNum;
    WhereConditionBO whereConditionBO;
    List<T> data;


    public Pager() {
    }

    public Pager(int page, int size) {
        this.page = page;
        this.size = size;
    }


    public int getPage() {
        return this.page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getSize() {
        return this.size;
    }

    public void setSize(int size) {
        this.size = size;
    }


    public int getTotalPage() {
        Long a = (totalNum + (size - 1) )/ size;
        return a == null ? 0 : a.intValue();
    }

    public long getTotalNum() {
        return this.totalNum;
    }

    public void setTotalNum(long totalNum) {
        this.totalNum = totalNum;
    }

    public int queryPage() {
        int p = this.page - 1;
        return p < 0 ? 0 : p;
    }

    public WhereConditionBO getWhereConditionBO() {
        return whereConditionBO;
    }

    public void setWhereConditionBO(WhereConditionBO whereConditionBO) {
        this.whereConditionBO = whereConditionBO;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public List<T> getData() {
        return data;
    }

}
